###########################################################################
#   Copyright (C) 1998-2013 by authors (see AUTHORS.txt )                 #
#                                                                         #
#   This file is part of OCLToys.                                         #
#                                                                         #
#   OCLToys is free software; you can redistribute it and/or modify       #
#   it under the terms of the GNU General Public License as published by  #
#   the Free Software Foundation; either version 3 of the License, or     #
#   (at your option) any later version.                                   #
#                                                                         #
#   OCLToys is distributed in the hope that it will be useful,            #
#   but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
#   GNU General Public License for more details.                          #
#                                                                         #
#   You should have received a copy of the GNU General Public License     #
#   along with this program.  If not, see <http://www.gnu.org/licenses/>. #
#                                                                         #
#   OCLToys website: http://code.google.com/p/ocltoys                     #
###########################################################################

###########################################################################
#
# Definition of the function for preprocessing OpenCL kernels
#
###########################################################################

FUNCTION(PreprocessOCLKernel KERNEL)
	MESSAGE(STATUS "Preprocessing OpenCL kernel: " ${KERNEL})

	IF(WIN32)
		# TODO
		MESSAGE(STATUS "ERROR: Kernel preprocessing is not available on Windows (TODO)")
	ELSE(WIN32)
		add_custom_command(
			OUTPUT preprocessed_${KERNEL}
			COMMAND cpp -I. -I../common <${KERNEL} >preprocessed_${KERNEL}
			MAIN_DEPENDENCY ${KERNEL}
		)
	ENDIF(WIN32)
ENDFUNCTION(PreprocessOCLKernel)
